//
//  AboutUsController.m
//  OnionHome
//
//  Created by fengjie on 2019/9/14.
//  Copyright © 2019 FengJie. All rights reserved.
//

#import "AboutUsController.h"
#import "AboutUsCell.h"
#import "UserAgreementController.h"
#import "PrivacyPolicyController.h"

@interface AboutUsController ()
/**listViewTool*/
@property (nonatomic,strong)UITableViewTool*listViewTool;
/**数据源*/
@property (nonatomic,strong)NSMutableArray*dataSoure;

@end

@implementation AboutUsController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"关于我们";
    [self.listViewTool.listView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(0);
    }];
}
-(UITableViewTool*)listViewTool{
    if(!_listViewTool){
        kWeakSelf(weakSelf);
        _listViewTool=[[UITableViewTool alloc] initWithFrame:CGRectZero style:UITableViewStylePlain registerCellClassName:NSStringFromClass([AboutUsCell class]) identifier:NSStringFromClass([AboutUsCell class]) dataArray:self.dataSoure delegate:self dataSourceBlock:^(id  _Nonnull TempCell, NSIndexPath * _Nonnull indexPath, id  _Nonnull TempData) {
            AboutUsCell * cell = (AboutUsCell *)TempCell;
            cell.indexPath = indexPath;
            cell.nameStr = TempData;
        } selectCell:^(id  _Nonnull TempCell, NSIndexPath * _Nonnull indexPath, id  _Nonnull TempData) {
            
            if (indexPath.row == 1) {
                [weakSelf.navigationController pushViewController:[UserAgreementController new] animated:YES];
            }else if (indexPath.row == 2){
                [weakSelf.navigationController pushViewController:[PrivacyPolicyController new] animated:YES];
            }
        }];
        [_listViewTool.listView setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];
        [_listViewTool.listView setSeparatorColor:UIColorFromRGB(0xE7EEE7)];
    }
    return _listViewTool;
}
-(NSMutableArray *)dataSoure{
    if (!_dataSoure) {
        NSArray * array = @[@"当前版本",@"用户协议",@"隐私条款"];
        _dataSoure =[NSMutableArray array];
        [_dataSoure addObjectsFromArray:array];
    }
    return _dataSoure;
}
@end
